package com.example.demo3.controller;

import com.example.demo3.entity.HwFacilityToilet;
import com.example.demo3.service.HwFacilityToiletService;
import com.example.demo3.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 环卫公厕基本数据维护
 */


@RequestMapping("/hwft")
@RestController
@Api("环卫公厕基本数据维护")
public class HwFacilityToiletController {

    @Autowired
    HwFacilityToiletService hwFacilityToiletService ;

    //条件查询列表，分页
    @RequestMapping("/gethwftlist")
    @ApiOperation("环卫公厕列表")
    public Result hwftlist(HwFacilityToilet hwFacilityToilet) {
        {
            return hwFacilityToiletService.hwftlist(hwFacilityToilet);
        }
    }
    //新增
    @PostMapping("/hwftadd")
    @ApiOperation("新增")
    public Result add(@RequestBody HwFacilityToilet hwFacilityToilet ) {
        return hwFacilityToiletService.hwftAdd(hwFacilityToilet);
    }
    //name查询
    @PostMapping("/hwftGetname")
    @ApiOperation("判断名字是否重复")
    public Result getName( String name) {
        return hwFacilityToiletService.getName(name);
    }
    //修改
    @PostMapping("/hwftUpdate")
    @ApiOperation("修改")
    public Result update(@RequestBody HwFacilityToilet hwFacilityToilet ) {
        return hwFacilityToiletService.hwftUpdate(hwFacilityToilet);
    }

    //删除
    @PostMapping("/hwftDelete")
    @ApiOperation("删除")
    public Result delete(int id ) {
        return hwFacilityToiletService.hwftDelete(id);
    }
}
